package com.granada.behaviour.pc.append;

import com.granada.entity.SysRole;
import com.granada.behaviour.base.UserBehavior;
import com.granada.utils.MapperBeanUtils;
import com.granada.vo.resp.UserOwnRoleRespVO;

import java.util.List;
import java.util.Set;

public class UserWithPingBehavior extends UserBehavior {
    @Override
    public List<Long> getRolesByUserId(Long userId) throws Exception {
        return null;
    }

    @Override
    public Set<Long> getPermissionsByUserId(Long userId) throws Exception {
        return null;
    }

    @Override
    public UserOwnRoleRespVO getUserOwnRole(Long userId) throws Exception {
        List<Long> roleIdsByUserId = MapperBeanUtils.getSysUserRoleMapper().getRoleIdsByUserId(userId);
        List<SysRole> sysRoles = MapperBeanUtils.getSysRoleMapper().selectByPingList();
        UserOwnRoleRespVO vo=new UserOwnRoleRespVO();
        vo.setAllRole(sysRoles);
        //用户所拥有的角色
        vo.setOwnRoles(roleIdsByUserId);
        vo.setId(userId);
        return vo;
    }

    @Override
    public void resetAccountAndPassword(Long id) throws Exception {

    }

//    @Override
//    public Object register() throws Exception {
//        return null;
//    }

    @Override
    public void setUserOwnRole(Long userId, List<Long> roleIds) {
    }

}
